<?php 
/**
 * 采集 thechive.com
 */

include '../init.php';

$dir = _DIRECTORY_VAR . DIRECTORY_SEPARATOR . 'collect' . DIRECTORY_SEPARATOR . 'thechive';
system_file_io::mkdir($dir);

$config = $dir . DIRECTORY_SEPARATOR . 'config.php';
if(!file_exists($config)) {
	exit('complete.');
}
$config = include $config;
$history = $dir . DIRECTORY_SEPARATOR . 'history.php';
if(!file_exists($history)) {
	$data = '<' . '?php return unserialize(\'' . addslashes(serialize(array())) . '\'); ?' . '>';
	file_put_contents($history, $data);
}
$history = include $history;


$http = new collection_collect_http();

foreach($config['url'] AS $url) {
	$response = $http->get($url);
	
	$filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'response.txt';
	file_put_contents($filename, $response);
	echo 1;
}



